package com.yjhb.android.sbz.fragment;

import android.view.View;

import com.yjhb.android.sbz.adapter.SystemAnnouncementAdapter;
import com.yjhb.android.sbz.entity.SystemAnnouncement;
import com.yjhb.android.sbz.mvp.sys.SystemAnnouncementPresenter;
import com.yjhb.android.sbz.mvp.sys.SystemAnnouncementView;

import java.util.List;

/**
 * 创建者 zx
 * 创建时间 2021/1/12 9:09
 */
public class SystemAnnouncementFragment extends BaseListFragment<SystemAnnouncementPresenter, SystemAnnouncementAdapter, SystemAnnouncement> implements SystemAnnouncementView {
    private final String TAG = "SystemAnnouncementFragment";


    @Override
    protected SystemAnnouncementAdapter getAdapter() {
        return new SystemAnnouncementAdapter(getContext());
    }

    @Override
    protected CharSequence getTips() {
        return null;
    }

    @Override
    protected void onLoadData(int size, int current) {
        presenter.getSystemNotice(size, current);
    }

    @Override
    protected SystemAnnouncementPresenter initPresenter() {
        return new SystemAnnouncementPresenter(this);
    }

    @Override
    public void onItemClick(int index, Object o) {

    }

    @Override
    public void onViewClick(View view, String msg, int index, Object o) {

    }

    @Override
    public void onLoad(List<SystemAnnouncement> systemNotices, boolean isRefresh) {
        loadingDialog.cancel();
        smartRefreshLayout.finishRefresh();
        smartRefreshLayout.finishLoadmore();
        if (isRefresh) {
            dataSet.clear();
        }
        dataSet.addAll(systemNotices);
        adapter.notifyDataSetChanged();
    }
}
